import java.util.Date;

public class Page {
        private String url;
        private Integer viewCount;
        private Date lastAccessTime;
        public Page(String url) {
            this.url = url;
            this.viewCount = 0;
            this.lastAccessTime = null;
        }

        public String getUrl() {
            return url;
        }

        public Integer getViewCount() {
            return viewCount;
        }

        public void incrementViewCount() {
            this.viewCount++;
            this.lastAccessTime = new Date(); // 更新访问时间为当前时间
        }

        public Date getLastAccessTime() {
            return lastAccessTime;
        }

        @Override
        public String toString() {
            return "URL: " + url + ", 访问量: " + viewCount + ", 最后访问时间: " + (lastAccessTime != null ? lastAccessTime.toString() : "无");
        }
    }


